package com.hnphqs;

import com.google.gson.internal.LinkedTreeMap;
import java.util.HashMap;
import java.util.Map;

public class MapConverter {

    public static HashMap<String, Object> toHashMap(Map<String, Object> source) {
        HashMap<String, Object> target = new HashMap<>();
        
        for (Map.Entry<String, Object> entry : source.entrySet()) {
            Object value = entry.getValue();
            
            // 如果值本身也是一个LinkedTreeMap，则递归转换
            if (value instanceof LinkedTreeMap) {
                value = toHashMap((LinkedTreeMap<String, Object>) value);
            }
            
            target.put(entry.getKey(), value);
        }
        
        return target;
    }
}
